package com.cqc.zhbjcqc.adapter;

import android.support.v4.view.ViewPager;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.cqc.zhbjcqc.application.ImageLoaderOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by cui on 2016/9/29.
 */

public class FragNewsItemViewPager extends BasePagerAdapter<String> {

    public FragNewsItemViewPager(List list) {
        super(list);
    }

    @Override
    public int getCount() {
        return Integer.MAX_VALUE;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        ImageView imageView = new ImageView(container.getContext());
        ImageLoader.getInstance().displayImage(list.get(position % list.size()),imageView, ImageLoaderOptions.pager_options);
        container.addView(imageView,params);
        return imageView;
    }
}
